<?php
	include_once '../inc/config.inc.php';
	include_once '../inc/mysql.inc.php';
	include_once '../inc/tool.inc.php';
	$template['title']='成员修改页';
	$template['keyword']='成员修改页';
	$template['css']=array('style/public.css');
	$link=connect();
	if(!isset($_GET['id']) || !is_numeric($_GET['id']))
	{
		skip('member_manager.php','error','id参数错误');
	}
	$query="select * from member where mid={$_GET['id']}";
	$result = execute($link,$query);
	if(!mysqli_num_rows($result))
	{
		skip('member_manager.php','error','成员不存在');
	}
	if(isset($_POST['submit']))
	{
			$check_flag='update';
		//验证填写信息
		include 'inc/check_shop_manager.inc.php';
		//$query="UPDATE tea SET faceimg='{$_POST['faceimg']}',name='{$_POST['name']}',price={$_POST['price']},weight={$_POST['weight']},units='{$_POST['units']}',discount={$_POST['discount']},protime={$_POST['protime']},shelflife='{$_POST['shelflife']}',orgplace='{$_POST['orgplace']}',clickcount={$_POST['clickcount']},ip={$_POST['ip']} where teaid ={$_GET['id']}";
		$query="UPDATE tea SET ursename='{$_POST['ursename']}',name='{$_POST['name']}',pwd=md5({$_POST['pwd']}),photo='{$_POST['photo']}',truename='{$_POST['truename']}',qq={$_POST['qq']},email='{$_POST['email']}',regtime= NOW( ) ,ip={$_POST['ip']}where mid = {$_GET['id']}";
		execute($link,$query);
		if(mysqli_affected_rows($link)==1)
		{
			skip('member_manager.php','ok','数据修改成功！');
		}else{
			skip('member_manager.php','error','数据修改失败，请重试！');
		}
	}
	$data = mysqli_fetch_assoc($result);
?>
<?php include 'inc/header.inc.php';  ?>
	<div id="main">
		<div class="title" style="margin-bootom:20px;">成员修改-<?php echo $data['username']?></div>
		<form method="POST">
			<table class="au">
				<tr>
					<td>用户名</td>
					<td><input name="username" type="text" value="<?php echo $data['username']?>" /></td>
					<td>
						不得为空，最大不得超过200个字符
					</td>
				</tr>
				<tr>
					<td>密码</td>
					<td><input name="pwd" type="password" value="<?php echo $data['pwd']?>"/></td>
					<td>
						填写中/英文名称
					</td>
				</tr>
				<tr>
					<td>成员头像</td>
					<td><input name="photo" type="text" value="<?php echo $data['photo']?>"/></td>
					<td>
						可以输入单精度数字
					</td>
				</tr>
				<tr>
					<td>真实名字</td>
					<td><input name="truename" type="text" value="<?php echo $data['truename']?>" /></td>
					<td>
						不得为空
					</td>
				</tr>
				<tr>
					<td>qq</td>
					<td><input name="qq" type="text" value="<?php echo $data['qq']?>" /></td>
					<td>
						不得为空
					</td>
				</tr>
				<tr>
					<td>邮箱</td>
					<td><input name="email" type="text" value="<?php echo $data['email']?>" /></td>
					<td>
						不得为空
					</td>
				</tr>
				<tr>
					<td>注册时间</td>
					<td><input name="regtime" type="text" value="<?php echo $data['regtime']?>" /></td>
					<td>
						不得为空
					</td>
				</tr>
				<tr>
					<td>ip地址</td>
					<td><input name="ip" type="text" value="<?php echo $data['ip']?>" /></td>
					<td>
						不得为空
					</td>
				</tr>
			</table>
				<?php /*鼠标移动变成手型*/ ?>
				<input style="cursor:pointer;" class="btn" type="submit" name="submit" value="修改" />
		</form>
	</div>
<?php include 'inc/footer.inc.php'; ?>